<!--{block return}-->
<!--up6上传面板 post_attach_tab_extra-->
<div class="p_opt" unselectable="on" id="{$editorid}_up6" style="display: none;">
	<div id="up6_frame" style="height:0px;"></div>
		<iframe id="up6_iframe" name="up6_iframe" frameborder="0" scrolling="no" src="about:blank" width="445px" height="468px"></iframe>
	</div>
	<div class="notice uploadinfo">{lang up6:filesize_limit}</div>
</div>
	<script type="text/javascript">
	_attachEvent($('e_up6_a'),'click',function(e){loadiframe(null,'up6_iframe');});
	_attachEvent($('e_btn_up6').getElementsByTagName('a')[0], 'click',function(e){hideConfirm();});
	_attachEvent($('e_btn_attachlist').getElementsByTagName('a')[0], 'click',function(e){showConfirm();});
	_attachEvent($('e_btn_upload').getElementsByTagName('a')[0], 'click',function(e){showConfirm();});
	var licnese="$lic";
	
	if(BROWSER.firefox && window.HTMLElement) {   //为 firefox 增加 innerText 方法
		HTMLElement.prototype.__defineGetter__("innerText", function(){
			var anyString = "";
			var childS = this.childNodes;
			for(var i=0; i<childS.length; i++) {
				if(childS[i].nodeType==1)
				anyString += childS[i].innerText;
				else if(childS[i].nodeType==3)
				anyString += childS[i].nodeValue;
			}
			return anyString;
		});
		HTMLElement.prototype.__defineSetter__("innerText", function(sText){
			this.textContent=sText;
		});
	}

	function showConfirm() {
		$('attach_confirms').style.display='';
	}

	function hideConfirm() {
		$('attach_confirms').style.display='none';
	}
	
		var uploaderInited = false;
		(function()
		{
			//插件执行完毕后事件
			window.InsertFile = function(fileName,fileUrl)
			{
				if (wysiwyg)
				{
					insertText('<a href="' + fileUrl + '">' + fileName + '</a><br/>',0,0,false);
				}
				else
				{
					insertText('[url]' + fileUrl + '[/url]',0,0,false);
				}
			};
		})();
	
	function loadiframe(url,iframeid,time,force){
		var swfupload = 1;
		var formhash = '{FORMHASH}';
		if(BROWSER.ie){
			var loading = "<div style='color:#777;font-size:12px;margin:-15px 0 0 -10px;padding:0px;'>{lang up6:wait_for_url}</div>";
			} else {
			var loading = "<div style='color:#777;font-size:12px;margin:-8px 0 0 -7px;padding:0px;'>{lang up6:wait_for_url}</div>";
		}


		var iframe = $(iframeid);

		if(url == null){
			ajaxget('plugin.php?id=up6:index&formhash='+formhash,'iframeurl','',null,null,function(){
				url = SITEURL+"source/plugin/up6/template/index.htm";
				time = time ? time : 200;
				force = force ? force : 0;
				if(iframe.src == "about:blank") {
					iframe.contentWindow.document.write(loading);
					//return false;
					setTimeout(function()
					{
						iframe.src = "about:blank";

						iframe.src = url;
					},time);
					} else if(force == 1) {
					setTimeout(function()
					{
						iframe.src = "about:blank";

						iframe.src = url;
					},time);
				}
			});
		} else {
			time = time ? time : 200;
			force = force ? force : 0;
			if(iframe.src == "about:blank") {

				setTimeout(function()
				{
					iframe.src = "about:blank";

					iframe.src = url;
				},time);
			} else if(force == 1) {
				setTimeout(function()
				{
					iframe.src = "about:blank";

					iframe.src = url;
				},time);
			}
		}
		// 页面超时监控,仅IE有效
		// if (BROWSER.ie) {
		//	var linster = setTimeout(function() {
		//		if(iframe.readyState != 'complete' && swfupload == 1){
		//			if(confirm('{lang xf_storage:timeout_tips}')){
		//				switchAttachbutton('swfupload');
		//			}
		//			} else if(iframe.readyState != 'complete' && swfupload == 0) {
		//			if(confirm('{lang xf_storage:timeout_tips}')){
		//				switchAttachbutton('upload');
		//			}
		//		}
		//	},60000);
		// }
	}
	</script>

<!--{/block}-->